package controllers;

import java.util.Collection;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import services.ProjectService;

import domain.Project;


@Controller
@RequestMapping("/project")
public class ProjectController extends AbstractController {
	
	//Services
	@Autowired
	private ProjectService projectService;
	
	
	//Constructors
	public ProjectController(){
		super();
	}
	
	// Listing methods
	//Not finished projects
	@RequestMapping(value = "/notFinishedList", method = RequestMethod.GET)
	public ModelAndView list() {
		ModelAndView result;
		Collection<Project> projects;
	
		projects = projectService.findNotFinishedProjects();

		result = new ModelAndView("project/list");
		result.addObject("requestURI", "project/notFinishedList.do");
		result.addObject("projects", projects);
		result.addObject("backURI", "/welcome/index.do");
		return result;
	}
	
	

	
	
}
